home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / GZIP107S.ZIP;1 / GZIP107.TAR / gzip-1.0.7 / zmore.in < prev    next >
Encoding:
Text File  |  1993-03-18  |  828 b   |  43 lines

  1. :
  2. #!/bin/sh
  3.  
  4. if test "`echo -n a`" = "-n a"; then
  5.   # looks like a SysV system:
  6.   n1=''; n2='\c'
  7. else
  8.   n1='-n'; n2=''
  9. fi
  10. if stty -cbreak 2>/dev/null; then
  11.   cb='cbreak'; ncb='-cbreak'
  12. else
  13.   # 'stty min 1' resets eof to ^a on both SunOS and SysV!
  14.   cb='min 1 -icanon'; ncb='icanon eof ^d'
  15. fi
  16. trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
  17.  
  18. if test $# = 0; then
  19.     gzip -cd | eval ${PAGER-more}
  20. else
  21.     FIRST=1
  22.     for FILE
  23.     do
  24.     if test $FIRST -eq 0; then
  25.         echo $n1 "--More--(Next file: $FILE)$n2"
  26.         stty $cb -echo 2>/dev/null
  27.         ANS=`dd bs=1 count=1 2>/dev/null` 
  28.         stty $ncb echo 2>/dev/null
  29.         echo " "
  30.         if test "$ANS" = 'e' -o "$ANS" = 'q'; then
  31.             exit
  32.         fi
  33.     fi
  34.     if test "$ANS" != 's'; then
  35.         echo "------> $FILE <------"
  36.         gzip -cd "$FILE" | eval ${PAGER-more}
  37.     fi
  38.     if test -t; then
  39.         FIRST=0
  40.     fi
  41.     done
  42. fi
  43.